package com.redistest.seckill.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class PasswordUtils {
    private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();

    // 加密密码
    public static String hashPassword(String rawPassword) {
        return encoder.encode(rawPassword);
    }

    // 验证密码
    public static boolean checkPassword(String inputPassword, String dbPassword) {
        return encoder.matches(inputPassword, dbPassword);
    }
}
